(*---------------------------------------------------------------------------
   :Program.    PopUp-Module
   :Version.    2.01 as Modula-2 modules pop.def and pop.mod.
   :Contants.   Usage of Amiga PopUp menus.
   :Remark.     Works similar to Intuition menus.
   :History.    V1.0, pop.c by Derek Zahn,
   :History.                   (Gambit Software, Madison WI) July 1987
   :History.    V2.0,  1:1  conversion to Modula-2 and
   :History.    V2.01, rectified and slightly improved version by
   :Author.     Jochen P. Kupfer,
   :Address.    Buchenweg 22, D-4006 Erkrath 2, West-Germany,
   :Phone.      2104-40673
   :Group.      SIGMA (Special Interest Group Modula-2 Amiga)
   :Date.       4/16-Feb-89
   :Copyright.  PD
   :Language.   Modula-2
   :Translator. M2Amiga V3.2d
---------------------------------------------------------------------------*)


DEFINITION MODULE pop;

FROM Intuition IMPORT WindowPtr, MenuPtr, MenuItemPtr;
FROM SYSTEM    IMPORT ADDRESS;


TYPE
 popFlags = (menuEnabled,popVerify,popRelease,popTidy,popPointRel,popWinRel,
             popRemember,popUsed,pf8,popMovePointer,pf10,pf11,
             popLeftButton,popRightButton,popTriggerDown,popTriggerUp);
 popFlagSet = SET OF popFlags;

CONST
  PopTitleHeight = 10; (* If you use bigger fonts in the Screen-RECORD
                          change it to 'ySize+2'. *)

TYPE
  popMenuPtr = POINTER TO popMenu;

  popMenu     = RECORD
     nextMenu :popMenuPtr; (* Not yet used, if you like to implement...!*)
     leftEdge :INTEGER;
      topEdge :INTEGER;
        width :INTEGER;
       height :INTEGER;
        flags :popFlagSet;
     menuName :ADDRESS;
    firstItem :MenuItemPtr;
  END;



(*
 * PopChoose(menPtr, winPtr)
 * menPtr -- pointer to the menu to pop
 * winPtr -- the window to which this menu relates.
 *           NIL is not allowed, since I don't see any use for a
 *           PopUpWindow for a window which is not open!
 *
 * This function provides a blocking pop-up menu.  It returns -1 if
 * either an error occurred attempting to pop or if no selection was made
 * by the user.  If a selection was made, a number between 0 and n-1 is
 * returned, where n is the number of MenuItems.
 *
 * -1 is also returned if a selection of a checked item was made.
 *
 * Since this code opens a window, it is up to the caller to be sure that
 * no scribbling in droll ways is done while this code is in progress.
 *)


PROCEDURE PopChoose(menPtr:popMenuPtr;winPtr:WindowPtr):LONGINT;


END pop.def

